package com.egame.manage.biz.server.gc;

import cn.egame.common.data.BaseDao;
import cn.egame.common.data.SqlUtils;
import cn.egame.common.exception.ExceptionCommonBase;
import cn.egame.interfaces.gc.GameChargeInfo;

public class GameChargeServiceDao extends BaseDao {

	public GameChargeServiceDao() throws ExceptionCommonBase {
		super("egame_game");
	}

	public int setGameChargeInfo(GameChargeInfo bean)throws ExceptionCommonBase{
		if(bean != null){
			String sql = "INSERT INTO t_game_charge ( g_id, charge_name, price, " +
					"FUNCTION, buy_guide, triger_condition, charge_type, operator_id ) VALUES (" +
					bean.getgId() + "," + 
					SqlUtils.QuataStr(bean.getChargeName()) + "," + 
					bean.getPrice() + "," +
					SqlUtils.QuataStr(bean.getFunction()) + "," + 
					SqlUtils.QuataStr(bean.getBugGuide()) + "," + 
					SqlUtils.QuataStr(bean.getTrigerCondition()) + "," + 
					bean.getChargeType() + "," + 
					bean.getOperatorId() + ")";
			System.out.println(sql);
			return this.executeUpdate(sql);
		}
		return -1;
	}
//	
//	public int getChargeCount(int gId) throws ExceptionCommonBase{
//		String sql = "SELECT COUNT(*) from t_game_charge where g_id =" + gId;
//		return this.getInt(sql);
//	}
//	
//	
}
